package com.lantian.oss.controller;

import com.lantian.common.result.Result;
import com.lantian.oss.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @name:
 * @description:
 * @author: meet
 * @create: 2020-04-30 17:23
 */
@CrossOrigin
@RestController
@RequestMapping("/oss")
@Api(description = "OSS业务")
public class FileController {

    @Autowired
    private FileService fileService;

    @PostMapping("/file/upload")
    @ApiOperation(value = "文件上传")
    public Result upload(MultipartFile file) {
        String url = fileService.upload(file);
        return Result.ok().data("url", url);
    }
}
